'use strict';
var Schema = require('mongoose').Schema,
    Model = require('../../../Base/server/controllers/Model');

var modelField = {};
//单号
modelField.Code = {
    type: String,
    Name: '编码',
    IsUnique: true,
    IsEmpty: false,
    trim: true
};
//批号
modelField.LotNumber = {
    type: String,
    trim: true
};
//物料
modelField.ItemMaster = {
    type: Schema.ObjectId,
    ref: 'ItemMaster'
};
//生产数量
modelField.Qty = {
    type: Number,
    Name: '生产数量',
    IsEmpty: false
};
//完工日期
modelField.CompleteTime = {
    type: Date
};
//完工量
modelField.CompleteQty = {
    type: Number
};
//状态 0: 开工 1：完工
modelField.Status = {
    type: Number
};
modelField.Remark = {
    type: String,
    default: '',
    trim: true
};
//ERP ID
modelField.ErpId = {
    type: String,
    trim: true
};

var newModel = new Model(modelField);
newModel.addIndex({ItemMaster: 1, Code: 1});
newModel.create('CompletePlan', '完工计划');
